package com.zhonghui.dolo.manager.dao.impl;

import com.zhonghui.dolo.manager.dao.ModuleDao;
import com.zhonghui.dolo.manager.dao.mapper.ModuleMapper;
import com.zhonghui.dolo.manager.model.Module;
import com.zhonghui.dolo.manager.model.ModuleExample;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class ModuleDaoImpl implements ModuleDao {

    @Autowired
    private ModuleMapper moduleMapper;

    @Override
    public List<Module> queryModelListByParentId(int parentId) {
        ModuleExample example = new ModuleExample();
        example.createCriteria().andParentIdEqualTo(parentId);
        return moduleMapper.selectByExample(example);
    }

    @Override
    public List<Module> queryModelListByModuleIds(List<Integer> moduleIdList) {
        ModuleExample example = new ModuleExample();
        example.createCriteria().andModuleIdIn(moduleIdList);
        return moduleMapper.selectByExample(example);
    }
}
